import router from '@/router'
import store from '@/store'

const whiteList = ['/login', '/404']

router.beforeEach(async(to, from, next) => {
  // if (store.getters.loginInfo.token) {
  //   if (!store.state.user.loginInfo.userId) {
  //     await store.dispatch('user/loginInfo')
  //   }
  //   if (to.path === '/login') {
  //     next('/')
  //   } else {
  //     next()
  //   }
  // } else {
  //   if (whiteList.includes(to.path)) {
  //     next()
  //   } else {
  //     next('/login')
  //   }
  // }
  next()
})
